Omikron BASIC for Apple Power Mac

5-5. FN - INPUT USING Contents | 5-7. LSET - NEXT

 

Chapter 5-6

The Command Set

INPUT$ - LPRINT

 

INPUT$
Type: Function
Syntax: INPUT$(<num.expression>[,<num.expression>])
INPUT$(<number of characters>[,<file number>])
Explanation: Reads a specific number of characters from the console (keyboard) and/or from the indicated file. INPUT$ can also be used to get data from the modem interface and/or printer interface. In this case, the channel must have been opened previously using OPEN "V" and/or OPEN "P."

Note: The system is not blocked if INPUT$ is used in order to get characters from the keyboard. Such pseudo multitasking commands as ON TIMER GOSUB as well as other programs will continue to run. Canceling a program with [Ctrl]+[C] is also possible during input.
Example:

    OPEN "I",1,FN Get_Fsspec$(0,0,"NEWOMBAS.INF")
    WHILE NOT EOF(1)
    PRINT INPUT$(1,1);
    WEND
    CLOSE 1
    PRINT "Press key ..."
    Dummy$= INPUT$(1)
    END

Result:

    The file NEWOMBAS.INF is read character by character and displayed on the screen.

See also: INPUT   INKEY$    INPUT # 
 

INSTR
Type: Function
Syntax: INSTR([<num.expression>,]<string expression>,<string expression>)
INSTR([<search start>,]<string expression>,<character string>)
Explanation: Searches for the specified character string in the string expression and returns its position. If the character string is not contained in the string expression, the functional value is 0.
The entire string expression is searched starting with the first character; however, it is also possible to pass a start position during <search start>. The first character in the <string expression> has position 1.
Example:

    PRINT INSTR("Omikron.Basic",".")

Result:

    8

Example:

    Path$="Macintosh HD:PROJECTS:BASIC:SOURCES:"
    P=INSTR(Path$,":")
    WHILE P
    PRINT "Colon found at position:"; P
    P=INSTR(P+1,Path$,":")
    WEND

Result:

    Colon found at position: 13
    Colon found at position: 22
    Colon found at position: 28
    Colon found at position: 36

See also: LEN     LEFT$     RIGHT$    MID$ 
 

INT
Type: Function
Syntax: INT(<num.expression>)
Explanation: Returns the next smaller integer. Consequently, positive values are rounded down and negative values are rounded up. The FIX function always rounds off.
Example:

    PRINT INT( PI ), INT(12.5), INT(-12.5) 

Result:

    3 12 -13

See also: FIX     FRAC 
 

INV
See also: MAT

 

IPL
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 

JOYSTICK
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 

KEY
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 

KEY LIST
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 

KILL
Type: Command
Syntax: KILL <string expression>
KILL <file name>
Explanation: The indicated file is deleted. A FileSpecificationRecord must be passed in the <file name>.
Example:

    KILL FN Get_Fsspec$(0,0,"TEST.BAS") 

Result:

    The file TEST.BAS is deleted.

See also:  
 

LDUMP
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 


LEFT$
Type: Function
Syntax: LEFT$(<string expression>,<num.expression>)
Explanation: Returns a partial string of the string expression beginning with the first character having the length indicated by the numerical expression. If the numerical expression is larger than the length of the string expression, the entire string is returned.
Example:

    A$="Omikron.Basic"
    PRINT LEFT$(A$,7)

Result:

    Omikron

See also: RIGHT$    MID$    INSTR 

 

LEN
Type: Function
Syntax: LEN(<string expression>)
Explanation: Returns the length of the string expression (max. 2147483647).
Example:

    PRINT LEN("Omikron Basic")

Result:

    13

See also: INSTR     LEFT$    RIGHT$    MID$
 

LET
Type: Command
Syntax: LET <variable>=<expression>
Explanation: Allocates the expression to the variable. However, this command can be omitted. It is only implemented for reasons of compatibility. The allocation definition then reads: <variable>=<expression>.
Example:

    LET A=5+3
    PRINT A

Result:

    8

See also:  

 

LIBRARY
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 

LIBRARY CODE
Type: This word is reserved. Please, do not use.
Explanation: LIBRARY CODE appears in line 65534 at the end of the program and represents a reloaded library. A copyright notice is found after the word, which usually can be used to determine what type of Library is affected.
Further information about the subject of Libraries can be found in the appendix: Additional Libraries for Omikron Basic.
 

LINE COLOR
Type: Command
Syntax: LINE COLOR=<num.expression>
Explanation: The numerical value is an index to the internal color map of Omikron Basic (CLUT). The actual ratio of the red, green, and blue components can be determined from the 'Internal Color Map of Omikron Basic' in the appendix.
Example:  
Result:  
See also: PALETTE   LINE PATTERN   LINE STYLE   LINE WIDTH  
Internal Color Map of Omikron Basic
 

LINE INPUT
Type: Command
Syntax: LINE INPUT [#<num.expression>] [<string expression>;]<variable>[[,<variable>]]
Explanation: In almost every respect, LINE INPUT corresponds to the normal INPUT. It even can be employed together with USING to input the mask the same way INPUT is being used (see INPUT USING). Merely such separators as commas are ignored by LINE INPUT. Input is always retrieved up to the end of the line. Thus, if more than one variable is supposed to be entered, these have to be indicated in separate lines.

Note: LINE INPUT does not block the system. Such pseudo multitasking commands as ON TIMER GOSUB as well as other programs will continue to run. Canceling a program with [Ctrl]+[C] is also possible during input.
Example:

    OPEN "O",1,FN Get_Fsspec$(0,0,"TEST.DAT") 
    WRITE #1,"123","456","487" 
    WRITE #1,"123","456","487" 
    CLOSE 1 
    OPEN "I",1,FN Get_Fsspec$(0,0,"TEST.DAT") 
    INPUT #1,A$,B$,C$ 
    LINE INPUT #1,Line$ 
    CLOSE 1
    PRINT A$,B$,C$
    PRINT Line$

Result:

    123 456 487
    "123","456","487"

See also: INPUT   INPUT #     INPUT USING 
 


LINE PATTERN
Type: Command
Syntax: LINE PATTERN=<num.expression>,<num.expression>
LINE PATTERN=<line pattern>,<line pattern>
Explanation: Long integers must be passed in the numerical expressions. An 8 x 8 bit pattern is created from the combined 64 bits of the two numbers. This pattern serves as fill pattern for lines if LINE STYLE= 0 is set. Every set bit triggers the foreground color; every unset bit the background color.

Tip: Because leading zeros are not displayed by the editor and binary numbers with a set bit in the highest digit are interpreted as negative numbers, it is sometimes hardly to see which bits are set in the pattern and which are not. To avoid this problems, you can use strings instead of numbers to define your patterns.

Note: Colored line patterns cannot be defined this way. However, it is possible to use a resource editor (e.g., ResEdit by Apple) and generate customized, colored line patterns.
Example:
LINE PATTERN= %01010101101010100101010110101010, %01010101101010100101010110101010
LINE WIDTH= 8:LINE STYLE= 0
DRAW 100,100 TO 200,200
'Using strings for defining the pattern.
LINE PATTERN= VAL("%10001000100010001000100010001000"), VAL("%00100010001000100010001000100010")
DRAW 100,200 TO 200,100
Result:
Two gray lines are drawn diagonally.
See also: FILL PATTERN= LINE STYLE=
 


LINE STYLE
Type: Command
Syntax: LINE STYLE=<num.expression>
Explanation: The numerical value specifies the fill pattern used in the case of drawing commands. Numbers between 0 and 38 can be used for the numerical expression. Other values return an undefined result. In the case of 0, the pattern defined with LINE PATTERN is employed.

Note: In order to draw the gap, color 0 is always used. Therefore, it is rather difficult to draw a white dashed line on a black background using a black & white resolution. The appropriate draw mode (MODE=) has to be selected as well.
Example:  
Result:  
See also: LINE COLOR    LINE PATTERN    LINE WIDTH 
 


LINE WIDTH
Type: Command
Syntax: LINE WIDTH=<num.expression>
LINE WIDTH=<line width in pixels>
Explanation: Adjusts the line width in pixels for DRAW, BOX, and RBOX commands.

Note: Different values are available for the widths and heights of the drawing pen using the procedure 'Set_Pen_Size(width,height)' from the Extension Library. This results in drawing with a rectangle instead of a square.
Example:  
Result:  
See also: BOX   RBOX   Set_Pen_Size
 

LIST
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 


LIST$
Explanation: This word is reserved. Please, do not use.
 

LLIST
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 


LN
Type: Function
Syntax: LN (<num.expression>)
Explanation: Calculates the natural logarithm of the numerical expression. The definition range encompasses all positive real numbers. Negative arguments lead to a NAN (Not A Number). LN is the reverse function of EXP.
Example:

    PRINT LN(EXP(1)), LN(10) 
    PRINT LN(-1) 

Result:

     1    2.30258509299405 
     NAN 

See also: LOG      EXP 
 

LOAD
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 

LOC
Type: Function
Syntax: LOC(<num.expression>)
LOC(<file number>)
Explanation: Specifies the number of the last read or written data record in a random access file. The file must have been opened previously with OPEN "R." If this file has not been accessed yet or if reading has exceeded the end of file, the function returns the value 0.
In the case of other file types, the position of the read-write pointer is returned as a functional value.
Example:  
Result:  
See also: LOF   EOF   OPEN 
 

LOCAL
Type: Command
Syntax: LOCAL <variable>[=<expression>][[,<variable>[=<expression>] ]]
Explanation: Defines one or several variables in a procedure or multi-line function as local and - if needed - allocates them the indicated expression. The local variable is valid only within this routine. If the routine calls itself (recursive programming), the local variables of the individual call depths differ. Variables can also be defined locally in a GOSUB subroutine using LOCAL. They then remain valid up to the next RETURN.

Important: LOCAL must not be used inside of structures (SELECT ... CASE, REPEAT ... UNTIL, ...). Exception: IF ... THEN
Example:

    A=15
    Example
    PRINT A,B
    END

    DEF PROC Example
    LOCAL A
    A=16:B=10
    PRINT A,B
    END_PROC

Result:

    16 10
    15 10

See also: DEF PROC   DEF FN   GOSUB 
 

LOCATE
Type: Command
Syntax: LOCATE <num.expression>,<num.expression>
LOCATE <line>,<column>
Explanation: Positions the cursor at the specified screen location. The uppermost line has the number one (1), while column counting begins at 0.
Example:

    LOCATE 3,5: PRINT "This is a test"

Result:

    This is a test

See also: PRINT @   CSRLIN   POS 
 

LOCK
Explanation: Has no application purpose in Omikron Basic 6 and is ignored by the compiler. Please, do not use.
 

LOF
Type: Function
Syntax: LOF(<num.expression>)
LOF(<file number>)
Explanation: If a sequential file is concerned, the length in bytes is returned; if the file is a random access file, the number of saved data records is returned. The end-of-file character (CHR$(26)) is counted as well, provided it is available. The file must have been opened previously using OPEN.
Example:  
Result:  
See also:  
 

LOG
Type: Function
Syntax: LOG(<num.expression>,<num.expression>)
LOG(<base>,<value>)
Explanation: Calculates the logarithm of the value for the specified base. Both <base> and <value> must be greater than 0.
Example:

    PRINT LOG(2,1024), LOG(3,81), LOG(10,8475) 

Result:

     10   4   3.92813970687512 

See also: LN     EXP 
 

LOW
Type: Function
Syntax: LOW(<num.expression>)
Explanation: Determines the lower 16 bits of the numerical expression converted to a long integer word. Counterpart to this function is HIGH.

Note: LOW(X) <> X AND $FFFF
Example:

    PRINT HEX$(LOW($12345678)), LOW(1025), LOW($1234FFFE)

Result:

     5678    1025   -2

See also: HIGH
 

LOWER$
Type: Function
Syntax: LOWER$(<string expression>)
Explanation: Converts all letters contained in the string expression to small letters. If MODE "D" is activated, the umlauts Ä, Ö, Ü are also converted. Counterpart to this function is UPPER$.
Example:

    PRINT LOWER$("This is a test: ÜÖÄ")

Result:

    this is a test: üöä

See also: UPPER$   MODE 
 

LPEEK
Type: Function
Syntax: LPEEK(<num.expression>)
LPEEK(<address>)
Explanation: Reads a long-word (32 bits) at the address indicated by the numerical expression.

Note: The address should be a number divisible by 4 (natural address for long-word operations). Although the PowerPC processor can indeed operate on any addresses (even odd ones); speed, however, clearly decreases as a result.
Example:  
Result:  
See also: PEEK   WPEEK   POKE   WPOKE    LPOKE
 

LPOKE
Type: Command
Syntax: LPOKE <num.expression>,<num. expression>
LPOKE <address>,<value>
Explanation: Posts <value> as a long-word at the address indicated. The value must be between -2147483648 and 2147483647.

Note: The address should be a number divisible by 4 (natural address for long-word operations). Although the PowerPC processor can indeed operate on any addresses (even odd ones); speed, however, clearly decreases as a result.
Example:  
Result:  
See also: POKE   WPOKE    PEEK    WPEEK   LPEEK
 

LPOS
Type: Function
Syntax: LPOS(<num.expression>)
Explanation: Returns the current print column. The numerical expression is of no significance but must be specified.
Example:  
Result:  
See also: LPRINT
 

LPRINT
Type: Command
Syntax: LPRINT [USING <string expression>] [[{;|,}<expression>]][{,|;}]
Explanation: The following expressions are output in the same manner as when using PRINT, although in this case output is on the printer. The same rules as for PRINT also apply to the formatting and tabulation of output. The additional USING command can be utilized in the same manner as PRINT USING.
The LPRINT command functions as follows:
Omikron Basic first checks whether a page was already initiated on the printer. If the answer is affirmative, the string expression is output at the current cursor position of this page. As soon as the cursor has reached the end of the page, this page is closed and a new one started automatically. However, the command LPRINT CHR$(12); can also be used to force closing of the current page at any time. The next LPRINT command will then automatically open a new page. This is especially important for whole-page printers such as laser printers because it is impossible to see any of the output before the page has been closed.
Once output is concluded, the last page is closed with LPRINT CHR$(26); concurrently with the entire document.

Note: LPRINT does not route data directly to the printer but directs it first into a printer port, which can be imagined as a virtual screen. Once data has been received by the printer port, the data is processed and send to the printer. If the user would like to select a printer or plotter directly, this can be effected by first opening the serial interface to the printer using OPEN "P" and then sending the control commands directly to the printer using PRINT # or PUT. However, this means the user has to program a driver for the printer her- or himself. This method is thus only recommended in the case of special applications.

Important: As soon as the program has concluded its data output, care should be taken to close the page and the printer port using LPRINT CHR$(26);. The result is that the remaining data is output as well. If it should happen that the printer driver is changed while the printer port is still open, the system might crash since newly chosen drivers are usually not compatible with the old printer ports. The commands INPUT, INPUT USING, and FORM_ALERT close a still open document. Thus, it is impossible to interrupt the print process with commands that turn the program into the active process.
Example:
FOR I=1 TO 3
LPRINT "page"+STR$(I)
LPRINT CHR$(12);
NEXT I
LPRINT CHR$(26);
END
Result:
The texts "page 1", "page 2", and "page 3" are output on the printer on 3 different pages.
See also: PRINT     PRINT #     PUT     LPOS    GRAF_PORT
 


5-5. FN - INPUT USING Contents | 5-7. LSET - NEXT

Tech-Support | Order | Start | Home: http://www.berkhan.com


© 1997-1999 Berkhan-Software